package org.hxzon.tapestry5.components;

import org.apache.tapestry5.MarkupWriter;
import org.hxzon.tapestry5.components.base.AbstractTextFieldEx;

//copy form TextArea
public class TextAreaEx extends AbstractTextFieldEx {
    private String value;

    @Override
    protected final void writeFieldTag(MarkupWriter writer, String value) {
        writer.element("textarea",

        "name", getControlName(),

        "id", getClientId(),

        "cols", getWidth());

        // Save until needed in after()

        this.value = value;
    }

    final void afterRender(MarkupWriter writer) {
        // TextArea will not have a template.

        if (value != null) {
            writer.write(value);
        }
        writer.end(); // textarea
    }
}
